<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<%@ include file="/WEB-INF/views/include/head.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>用户管理</title>
    <script type="text/javascript">
        $(function () {
            $('#pageLimit').bootstrapPaginator({
                bootstrapMajorVersion: 3, //版本
                currentPage: ${page.pageNo},
                totalPages: ${page.totalPage},
                numberOfPages:5,
                size:"small",
                alignment:"right",
                itemTexts: function (type, page, current) {
                    switch (type) {
                        case "first": return "首页";
                        case "prev": return "上一页";
                        case "next": return "下一页";
                        case "last": return "末页";
                        case "page": return page;
                    }
                },
                //点击事件
                onPageClicked: function (event, originalEvent, type, page) {
                    location.href = "${ctx}/resource/basic/user/?pageNo=" + page + "&pageSize=10";
                }
            });
        })
    </script>
</head>
<body>
<ol class="breadcrumb">
    <li><a href="#">资源管理</a></li>
    <li><a href="#">基础信息</a></li>
    <li class="active"><a href="#">用户管理</a></li>
</ol>
<ul class="nav nav-tabs">
    <li class="active"><a href="${ctx}/resource/basic/user/">用户列表</a></li>
    <shiro:hasPermission name="basic:user:edit"><li ><a href="${ctx}/resource/basic/department/form" >添加用户</a></li> </shiro:hasPermission>
</ul>
<div id="myTabContent" class="tab-content">
    <div id="messageBox" class="alert alert-warning ${empty message ? 'hide' : ''}"><button data-dismiss="alert" class="close">×</button>
        <label id="loginError" class="error">${message}</label>
    </div>
    <div class="tab-pane fade active in" id="department">
        <table id="departmentTable" class="table table-hover table-striped">
            <thead>
            <tr>
                <th>用户名<i class="sort"></i></th>
                <th>用户编号</th>
                <th>所属部门</th>
                <th>用户描述</th>
                <shiro:hasPermission name="basic:user:edit">
                    <th>操作</th>
                </shiro:hasPermission>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${page.list}" var="user">
                <c:if test="${user.showSign eq '1'}">
                    <tr>
                        <td>${user.name}</td>
                        <td>${user.code}</td>
                        <td>${user.department.name}</td>
                        <td>${user.description}</td>
                        <shiro:hasPermission name="basic:user:edit">
                            <td>
                                <a href="${ctx}/resource/basic/user/form?id=${department.id}" >修改</a>
                                <a href="${ctx}/resource/basic/user/delete?id=${department.id}" > 删除</a>
                            </td>
                        </shiro:hasPermission>
                    </tr>
                </c:if>
            </c:forEach>
            </tbody>
        </table>
        <ul id="pageLimit"></ul>
    </div>
</div>
</body>
</html>